Print the digits 1, 2, 3, 4, 5.
Input. There is no input data.
Output. Print the digits 1, 2, 3, 4, 5,
each on a separate line, as shown in the sample.
Sample
input |
Sample
output |
|
1 2 3 4 5 |
elementary problem
In this problem, you must
print the numbers from 1 to 5, each on a separate line.
Algorithm realization
Print the numbers as characters,
separating them with the newline character ‘\n’.
#include <stdio.h>
int main(void)
{
printf("1\n2\n3\n4\n5\n");
return 0;
}
Java realization
Print the numbers as characters,
separating them with the newline character ‘\n’.
import java.util.*;
public class Main
{
public static void
main(String[] args)
{
System.out.println("1\n2\n3\n4\n5\n");
}
}
Python realization
Print the numbers as characters,
separating them with the newline character ‘\n’.
print("1\n2\n3\n4\n5\n")